package com.hyperboost.backend.service.impl;

import java.util.List;
import com.hyperboost.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hyperboost.backend.mapper.OpportunityCategoryMapper;
import com.hyperboost.backend.domain.OpportunityCategory;
import com.hyperboost.backend.service.IOpportunityCategoryService;

/**
 * 机会分类Service业务层处理
 * 
 * @author LXY
 * @date 2025-04-08
 */
@Service
public class OpportunityCategoryServiceImpl implements IOpportunityCategoryService 
{
    @Autowired
    private OpportunityCategoryMapper opportunityCategoryMapper;

    /**
     * 查询机会分类
     * 
     * @param categoryId 机会分类主键
     * @return 机会分类
     */
    @Override
    public OpportunityCategory selectOpportunityCategoryByCategoryId(Long categoryId)
    {
        return opportunityCategoryMapper.selectOpportunityCategoryByCategoryId(categoryId);
    }

    /**
     * 查询机会分类列表
     * 
     * @param opportunityCategory 机会分类
     * @return 机会分类
     */
    @Override
    public List<OpportunityCategory> selectOpportunityCategoryList(OpportunityCategory opportunityCategory)
    {
        return opportunityCategoryMapper.selectOpportunityCategoryList(opportunityCategory);
    }

    /**
     * 新增机会分类
     * 
     * @param opportunityCategory 机会分类
     * @return 结果
     */
    @Override
    public int insertOpportunityCategory(OpportunityCategory opportunityCategory)
    {
        opportunityCategory.setCreateTime(DateUtils.getNowDate());
        return opportunityCategoryMapper.insertOpportunityCategory(opportunityCategory);
    }

    /**
     * 修改机会分类
     * 
     * @param opportunityCategory 机会分类
     * @return 结果
     */
    @Override
    public int updateOpportunityCategory(OpportunityCategory opportunityCategory)
    {
        opportunityCategory.setUpdateTime(DateUtils.getNowDate());
        return opportunityCategoryMapper.updateOpportunityCategory(opportunityCategory);
    }

    /**
     * 批量删除机会分类
     * 
     * @param categoryIds 需要删除的机会分类主键
     * @return 结果
     */
    @Override
    public int deleteOpportunityCategoryByCategoryIds(Long[] categoryIds)
    {
        return opportunityCategoryMapper.deleteOpportunityCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除机会分类信息
     * 
     * @param categoryId 机会分类主键
     * @return 结果
     */
    @Override
    public int deleteOpportunityCategoryByCategoryId(Long categoryId)
    {
        return opportunityCategoryMapper.deleteOpportunityCategoryByCategoryId(categoryId);
    }
}
